<#assign title=data.name />
<#assign activeTitle='project' />
<#include "/frag.head.ftl">
<style>
  .tab-content .panel {
    border-top: none;
  }
</style>
<h1>${data.name}
  <small>
    <a href="javascript:;" onclick="editProject('${data.name}')"><i class="fa fa-fw fa-edit"></i></a>
  </small>
</h1>

<hr/>

<ul class="nav nav-tabs" id="thetab">
  <li role="presentation" class="active"><a href="/project/${data.name}/segments">配置段</a></li>
  <li role="presentation"><a href="/project/${data.name}/perm">成员</a></li>
  <li role="presentation"><a href="/project/${data.name}/instance">实例</a></li>
  <li role="presentation"><a href="/project/${data.name}/release">发布历史</a></li>
</ul>

<div class="tab-content">
  <div role="tabpanel" class="tab-pane fade in active">
    <div class="panel panel-default">
    <#list data.segments as seg>

      <div class="panel-heading">
        &nbsp;
        <div class="pull-left">
           <b> ${seg.name}&nbsp;</b>
          <button class="btn btn-xs btn-warning" onclick="openDialog({title:'${seg.name} Preview',content:'/project/${data.name}/${seg.name}/preview'})">预览</button> &nbsp;
          <#if (seg.exists)>
          <button class="btn btn-xs btn-danger" onclick="openDialog({title:'${seg.name} diff',content:'/project/${data.name}/${seg.name}/diff'})">对比</button> &nbsp;
          <button class="btn btn-xs btn-success" onclick="openDialog({title:'${seg.name} released',content:'/project/${data.name}/${seg.name}/raw'})">已发布</button> &nbsp;
          </#if>
        </div>
      </div>
      <div class="panel-body">
          <#list seg.configFiles as f>
            <p><a href="/project/${data.name}/cf_view?full_name=${f}">${f}</a></p>
          </#list>
      </div>

    </#list>
    </div>
  </div><!-- summary -->

</div><!-- tab-content -->


<#include "/frag.foot.ftl">

<script type="text/javascript">

  function openDialog(options){
    top.layer.open($.extend({
      type: 2, shadeClose: true, resize: true, anim: 0, skin: 'layer-class',
      area: ['760px', '590px']
    },options));
  }

</script>